﻿using System;
using System.Collections;
using System.Globalization;
using System.Windows.Data;

namespace TestSendTool.Tools.Converter
{
    public class ElementIndexConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Length == 2 && values[0] != null && values[1] is IList items)
                return (items.IndexOf(values[0]) + 1).ToString();
            return Binding.DoNothing;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
